package com.fanqwz.hexieshe.domain.usercase;

import com.fanqwz.hexieshe.domain.Comment;
import com.fanqwz.hexieshe.domain.executor.PostExecutionThread;
import com.fanqwz.hexieshe.domain.repository.Repository;

import java.util.List;
import java.util.concurrent.Executor;

import javax.inject.Inject;

import io.reactivex.Observable;

/**
 * Created by fanqw on 2017/7/7.
 */

public class GetCommentUseCase extends UseCase<List<Comment>, GetCommentUseCase.Params> {
    private final Repository repository;

    @Inject
    GetCommentUseCase(Repository repository, Executor threadExecutor, PostExecutionThread postExecutionThread) {
        super(threadExecutor, postExecutionThread);
        this.repository = repository;
    }

    @Override
    Observable<List<Comment>> buildUseCaseObservable(Params params) {
        return repository.comments(params.articleID);
    }

    public static class Params {
        long articleID;
        public Params(long articleID) {
            this.articleID = articleID;
        }
    }
}
